UNIT-5
8051 INSTRUCTION SET AND PROGRAMMING
Introduction,
Addressing modes of 8051,
Instruction set of 8051,
Data Transfer Instructions,
Data and Bit-Manipulation Instructions,
Arithmetic Instructions,
simple programs,
Interfacing Examples: External memory interfacing in 8051,
interfacing of push button switches and LEDS,
Interfacing of Relay, Interfacing of seven segment displays,
Interfacing of Key board.
Case Study:
1. Interfacing of Seven segment display with 8051 microcontroller
2. Switch interfacing with 8051 microcontroller
3. Relay interfacing with 8051 microcontroller
----------------------------------------------------------------------------------------------------------------
INTRODUCTION
With the basic idea on the architecture and the memory organization of 8051, it is easy to study
the instruction set and its flexibility for control applications. Unlike the 8085 instruction set, 8051
instruction set has the instructions for bit manipulations. the 8051 instruction set supports the
addressing modes such as indexed addressing and relative addressing.
ADDRESSING MODES OF 8051
The way by which a data in specified in an instruction is called as addressing mode. The data
fetched for execution depends upon the addressing mode.
The instruction set of 8051 supports 5 addressing modes.
1. Immediate Addressing
2. Register Addressing
3. Direct Addressing or Memory Direct addressing
4. Register Indirect Addressing or Memory indirect Addressing
5. Indexed Addressing
Immediate Addressing Mode:
• The data to be manipulated is directly given in the instruction itself.
• The data is preceded by a # symbol.
• E.g. ADD A, #80h.
•This instruction adds the data 80h to the contents of the accumulator and the result is stored in the
accumulator itself.
For example –
ADD A, #77; Adds 77 (decimal) to A and stores in A
ADD A, #4DH; Adds 4D (hexadecimal) to A and stores in A
MOV DPTR, #1000H; Moves 1000 (hexadecimal) to data pointer
Register Addressing Mode:
The register, that contains the data to be manipulated, is specified in the instruction.
E.g. ADD A, R0.